package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import com.IUT.biblio.model.*;
import java.util.HashMap;

public final class consultLect_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

  private static java.util.List _jspx_dependants;

  static {
    _jspx_dependants = new java.util.ArrayList(4);
    _jspx_dependants.add("/design.css");
    _jspx_dependants.add("/entete.html");
    _jspx_dependants.add("/menu.html");
    _jspx_dependants.add("/footer.html");
  }

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.AnnotationProcessor _jsp_annotationprocessor;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
  }

  public void _jspDestroy() {
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html; charset=ISO-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\r\n");
      out.write("<title>Consultation d'un lecteur</title>\r\n");
      out.write("<style type=\"text/css\">\r\n");
      out.write("@CHARSET \"UTF-8\";\r\n");
      out.write("*{ margin:0; padding:0;}\r\n");
      out.write("body{ font:100% normal Arial, Helvetica, sans-serif; }\r\n");
      out.write("form,input,select,textarea{margin:0; padding:0; color:#ffffff;}\r\n");
      out.write("\r\n");
      out.write("h1{\r\n");
      out.write("\twidth:50%;\r\n");
      out.write("\tmargin:auto;\r\n");
      out.write("\tbackground-color:gray;\r\n");
      out.write("\tcolor:white;\r\n");
      out.write("\ttext-align:center;\r\n");
      out.write("\tpadding-bottom:5px;\t\r\n");
      out.write("\tmargin-bottom:20px;\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("#menu{\r\n");
      out.write("\tfloat:left;\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("#menu a,a:visited{\r\n");
      out.write("\tcolor:gray;\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("#menu a:hover{\r\n");
      out.write("\tcolor:#BFBFBF;\t\r\n");
      out.write("}\r\n");
      out.write("#contenu{\r\n");
      out.write("\twidth:70%;\r\n");
      out.write("\tposition: relative;\r\n");
      out.write("\tmargin:auto;\r\n");
      out.write("\tborder: solid 1px black;\r\n");
      out.write("\tmargin-bottom:10px;\r\n");
      out.write("\tpadding-left:20px;\r\n");
      out.write("\tpadding-bottom:10px;\r\n");
      out.write("\tmin-height: 400px;\r\n");
      out.write("\tbackground:#161712;\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("#contenu a,a:visited{\r\n");
      out.write("\tcolor: white;\r\n");
      out.write("\tbackground:#AAAAAA;\r\n");
      out.write("\tpadding: 5px;\r\n");
      out.write("\tpadding-top: 2px;\r\n");
      out.write("\tpadding-bottom: 2px;\r\n");
      out.write("\tborder:solid 1px gray;\r\n");
      out.write("\tposition:absolute;\r\n");
      out.write("\tbottom:20px;\r\n");
      out.write("\tleft:20px;\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("#contenu a:hover{\r\n");
      out.write("\tcolor: #EDEDED;\r\n");
      out.write("\tbackground:#AAAAAA;\r\n");
      out.write("\tpadding: 5px;\r\n");
      out.write("\tpadding-top: 2px;\r\n");
      out.write("\tpadding-bottom: 2px;\r\n");
      out.write("\tborder:solid 1px gray;\r\n");
      out.write("}\r\n");
      out.write("form{\r\n");
      out.write("\tmargin:auto;\r\n");
      out.write("\twidth:360px;\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("form label{\r\n");
      out.write("\tclear:left;\r\n");
      out.write("}\r\n");
      out.write("form .gauche{\r\n");
      out.write("\tfloat:left;\t\r\n");
      out.write("}\r\n");
      out.write("form select, input{\r\n");
      out.write("\tmargin-bottom:5px;\t\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("label{\r\n");
      out.write("\tmargin-left : 5px;\r\n");
      out.write("}\r\n");
      out.write(".sub{\r\n");
      out.write("\tmargin-left:100px;\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write(".red{\r\n");
      out.write("\ttext-decoration:italic;\r\n");
      out.write("\tcolor:red;\r\n");
      out.write("}\r\n");
      out.write("#footer{\r\n");
      out.write("\tclear:left;\r\n");
      out.write("\twidth:50%;\r\n");
      out.write("\tmargin:auto;\r\n");
      out.write("\tbackground-color:gray;\r\n");
      out.write("\tcolor:white;\r\n");
      out.write("\ttext-align:center;\r\n");
      out.write("\tpadding-top:1px;\r\n");
      out.write("\tpadding-bottom:1px;\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("div.box {\r\n");
      out.write("margin:0 auto;\r\n");
      out.write("width:500px;\r\n");
      out.write("background:#222222;\r\n");
      out.write("position:relative;\r\n");
      out.write("top:50px;\r\n");
      out.write("border:1px solid #262626;\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("div.box h1 { \r\n");
      out.write("color:#ffffff;\r\n");
      out.write("font-size:18px;\r\n");
      out.write("text-transform:uppercase;\r\n");
      out.write("padding:5px 0 5px 5px;\r\n");
      out.write("border-bottom:1px solid #161712;\r\n");
      out.write("border-top:1px solid #161712; \r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("div.box label {\r\n");
      out.write("width:100%;\r\n");
      out.write("display: block;\r\n");
      out.write("background:#1C1C1C;\r\n");
      out.write("border-top:1px solid #262626;\r\n");
      out.write("border-bottom:1px solid #161712;\r\n");
      out.write("padding:10px 0 10px 0;\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("div.box label span {\r\n");
      out.write("display: block;\r\n");
      out.write("color:#bbbbbb;\r\n");
      out.write("font-size:12px;\r\n");
      out.write("float:left;\r\n");
      out.write("width:100px;\r\n");
      out.write("text-align:right;\r\n");
      out.write("padding:5px 20px 0 0;\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("div.box .input_text {\r\n");
      out.write("padding:10px 10px;\r\n");
      out.write("width:200px;\r\n");
      out.write("background:#262626;\r\n");
      out.write("border-bottom: 1px double #171717;\r\n");
      out.write("border-top: 1px double #171717;\r\n");
      out.write("border-left:1px double #333333;\r\n");
      out.write("border-right:1px double #333333;\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("div.box .message{\r\n");
      out.write("padding:7px 7px;\r\n");
      out.write("width:350px;\r\n");
      out.write("background:#262626;\r\n");
      out.write("border-bottom: 1px double #171717;\r\n");
      out.write("border-top: 1px double #171717;\r\n");
      out.write("border-left:1px double #333333;\r\n");
      out.write("border-right:1px double #333333;\r\n");
      out.write("overflow:hidden;\r\n");
      out.write("height:150px;\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("div.box .button\r\n");
      out.write("{\r\n");
      out.write("margin:0 0 10px 0;\r\n");
      out.write("padding:4px 7px;\r\n");
      out.write("background:#CC0000;\r\n");
      out.write("border:0px;\r\n");
      out.write("position: relative;\r\n");
      out.write("top:10px;\r\n");
      out.write("left:382px;\r\n");
      out.write("width:100px;\r\n");
      out.write("border-bottom: 1px double #660000;\r\n");
      out.write("border-top: 1px double #660000;\r\n");
      out.write("border-left:1px double #FF0033;\r\n");
      out.write("border-right:1px double #FF0033;\r\n");
      out.write("}");
      out.write("\r\n");
      out.write("</style>\r\n");
      out.write("</head>\r\n");
      out.write("<body>\r\n");
      out.write("\t");
      out.write("\t<div id=\"entete\">\r\n");
      out.write("\t\t<h1>Gestion d'une bibliotheque</h1>\r\n");
      out.write("\t</div>\r\n");
      out.write("\t");
      out.write('\r');
      out.write('\n');
      out.write('	');
      out.write("<div id=\"menu\">\r\n");
      out.write("\t\t<h3>Les lecteurs</h3>\r\n");
      out.write("\t\t<ul>\r\n");
      out.write("\t\t\t<li><a href=\"/Biblio/lecteur/ajouter\">Ajouter un lecteur</a></li>\r\n");
      out.write("\t\t\t<li><a href=\"/Biblio/lecteur/\">Consulter un lecteur</a></li>\r\n");
      out.write("\t\t</ul>\r\n");
      out.write("\t\t<h3>Les ouvrages</h3>\r\n");
      out.write("\t\t<ul>\r\n");
      out.write("\t\t\t<li><a href=\"/Biblio/ouvrage/ajouter\">Ajouter un ouvrage</a></li>\r\n");
      out.write("\t\t\t<li><a href=\"/Biblio/exemplaire/ajouter\">Ajouter un exemplaire</a></li>\r\n");
      out.write("\t\t\t<li><a href=\"/Biblio/ouvrage/\">Consulter un ouvrage</a></li>\r\n");
      out.write("\t\t</ul>\r\n");
      out.write("\t</div>\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\t<div id=\"contenu\">\r\n");
      out.write("\t\t<h1>Consultation d'un lecteur</h1>\r\n");
      out.write("\t\t");
 ServletContext context = getServletContext();
		Bibliotheque bibli = (Bibliotheque)context.getAttribute("biblio");
		if(bibli.nbLec()!=0){ 
      out.write("\r\n");
      out.write("\t\t<form method=\"post\" action=\"lecteur.do\">\r\n");
      out.write("\t\t\t<fieldset>\r\n");
      out.write("\t\t\t\t<input type=\"hidden\" name=\"actForm\" value=\"consultLect\" />\r\n");
      out.write("\t\t\t\t<label for=\"id\">Numéro du lecteur : </label>\r\n");
      out.write("\t\t\t\t<select name=\"id\">\r\n");
      out.write("\t\t\t\t\t");

					HashMap<Integer, Lecteur> lesLecteurs = bibli.getLecteurs();
					int id;
					if(request.getAttribute("id")==null)
						id=-1;
					else
						id=(Integer)request.getAttribute("id");
					
					for(Integer num : lesLecteurs.keySet()) {
						out.print("<option value=\""+ num+"\"");
						if(num==id)
							out.print("selected=\"selected\"");
						out.println(">"+num+"</option>");
					}	
					
      out.write("\r\n");
      out.write("\t\t\t\t</select>\r\n");
      out.write("\t\t\t\t<input class=\"sub\" type=\"submit\" value=\"Envoyer\"/>\t\t\t\t\r\n");
      out.write("\t\t\t</fieldset>\r\n");
      out.write("\t\t</form>\r\n");
      out.write("\t\t\r\n");
      out.write("\t\t\t");
 
			if(id!=-1) {
				Lecteur l = lesLecteurs.get(id);
				
				out.print("<pre>"+l.infoLecteur()+"</pre>");
			}	
			
      out.write("\r\n");
      out.write("\t\t");
}else{ 
      out.write("\r\n");
      out.write("\t\t<p><strong>Aucun lecteur à consulter.</strong>\r\n");
      out.write("\t\t");
 } 
      out.write("\r\n");
      out.write("\t\t<p><a href=\"/Biblio\">Retour</a></p>\r\n");
      out.write("\t</div>\r\n");
      out.write("\t");
      out.write("<div id=\"footer\">\r\n");
      out.write("\t\t<p>Exercice d'application JEE. </p>\r\n");
      out.write("</div>");
      out.write("\t\r\n");
      out.write("</body>\r\n");
      out.write("</html>");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
